package com.itxiao.controller;
import com.itxiao.entity.SysDictData;
import com.itxiao.entity.SysDictType;
import com.itxiao.pojo.bo.Page;
import com.itxiao.pojo.vo.R;
import com.itxiao.service.SysDictDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * 字典数据表(SysDictData)表控制层
 *
 * @author makejava
 * @since 2025-10-11 16:42:07
 */
@RestController
@RequestMapping("admin/api/v1/sys-dict/data")
@Api(tags = "字典数据")
@CrossOrigin
public class SysDictDataController {
    /**
     * 服务对象
     */
    @Resource
    private SysDictDataService sysDictDataService;


    @ApiOperation("分页查询")
    @PostMapping("/query")
    public R queryList(@RequestBody Page page) {
        return sysDictDataService.queryList(page);
    }

    @ApiOperation("添")
    @PostMapping("/add")
    public R add(@RequestBody SysDictData sysDictData) {
        return sysDictDataService.add(sysDictData);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    public R update(@RequestBody  SysDictData sysDictData) {
        return sysDictDataService.updateInfo(sysDictData);
    }
    @ApiOperation("批量删除")
    @DeleteMapping("/delete")
    public R deleteBatch(@RequestBody List<Integer> ids) {
        return R.ok(sysDictDataService.removeBatchByIds(ids));
    }

    @ApiOperation("查询详情")
    @DeleteMapping("/query-detail/{id}")
    public R getById(@PathVariable Integer id) {
        return R.ok(sysDictDataService.getById(id));
    }
    @ApiOperation("单个删除")
    @DeleteMapping("/delete/{id}")
    public R deleteById(@PathVariable Integer id) {
        return R.ok(sysDictDataService.deleteById(id));
    }
}

